/**
 * 
 */
package cn.tonyqiu.wonuly.service.util;

import org.springframework.security.context.SecurityContextHolder;
import org.springframework.security.userdetails.UserDetails;

/**
 * To provide the utill method
 * 
 * @author <a href="mailto:tony.qiu.smart@gmail.com">Tony Qiu</a>
 * 
 */
public class UserServiceUtil {

	/**
	 * Get the user name
	 */
	public static String getUserEmail() {
		String username = ((UserDetails)SecurityContextHolder.getContext()
				.getAuthentication().getPrincipal()).getUsername();
		if(username == null || "".equals(username)) {
			return null;
		}
		return username;
	}

}
